const express = require("express");
const history = require("connect-history-api-fallback");
const {createProxyMiddleware} = require("http-proxy-middleware");
const app = express();
app.use(history({
    index:"home.html",// 将默认文件index.html--->home.html
}));
app.use(express.static(__dirname));
app.use("/auth",createProxyMiddleware({
    target:"http://139.198.34.216:8230/admin",// 请求服务地址
    changeOrigin:true,// 允许跨域
}))
app.use("/syt",createProxyMiddleware({
    target:"http://syt-api.atguigu.cn",
    changeOrigin:true,
    pathRewrite:{
        "^/syt":""
    }
}))
app.listen(8091,()=>{
    console.log('success');
})